package network_demo.TCP_Demo;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

/**
 * @author ChenYongHao
 * @date 2023/4/28 14:40
 * @desc 发送数据
 */

public class ClientDemo {
    public static void main(String[] args) throws IOException {
        // 1.创建客户端的Socket对象
        Socket s = new Socket("127.0.0.1", 10086);
        // 2.获取输出流对象，写数据
        OutputStream os = s.getOutputStream();
        os.write("Hello,World!".getBytes());
        // 3.释放资源
        s.close();
    }
}
